clear
capture log close

log using self_coding.log, replace

version 16.1 

*     ***************************************************************** *;
*       File-Name:      self_coding.do									*;
*       Date:           June 20, 2021		                           	*;
*       Author:         Amber Boydstun (aboydstun@ucdavis.edu)			*;
*       Purpose 1:      Analyze survey data to compare participants'	*;
*						self-coding to researcher coding				*;
*		Purpose 2:		Identify observations related to education,		*;
*						laziness, cost of living, unemployment			*;  
*		Purpose 3: 		Run t-tests to see whether coding discrepancies *;
*						vary significantly by demographic group			*;
*       Data Input:    	Self Coding Survey Data, for Stata.xlsx         *;
*     ****************************************************************  *;

import excel "Self Coding Survey Data, for Stata.xlsx", firstrow case(lower)

gen case_id = _n

*** Generate total count of attribution responses, per participate 
egen countpcD = anycount(gedo1 gedo2 gedo3 gedo4 gedo5 gedo6 gedo7 gedo8 gedo9 gedo10), values(1)
egen countpcGE = anycount(gedo1 gedo2 gedo3 gedo4 gedo5 gedo6 gedo7 gedo8 gedo9 gedo10), values(2)
egen countpcO = anycount(gedo1 gedo2 gedo3 gedo4 gedo5 gedo6 gedo7 gedo8 gedo9 gedo10), values(3)

egen totalpc = rownonmiss(gedo1 gedo2 gedo3 gedo4 gedo5 gedo6 gedo7 gedo8 gedo9 gedo10)

* D = Individual
egen total_reasons_D = total(countpcD)

* GE = Government / Society
egen total_reasons_GE = total(countpcGE)

* O = Other
egen total_reasons_O = total(countpcO)

*** Generate gov/society blame as # of gov/society blame reasons divided by total # of ind. + gov/society reasons, ignoring "other"
gen pctpcGE = countpcGE/(countpcGE+countpcD)
*** Generate individual blame as # of ind. blame reasons divided by total # of ind. + gov/society reasons, ignoring "other"
gen pctpcD = countpcD/(countpcGE+countpcD)

gen total_reasons = countpcD + countpcGE + countpcO
egen total_reasons_all = total(total_reasons)

***************************************************
*** 			SUMMARY STATISTICS				***
***************************************************
sum total_reasons_D
sum total_reasons_GE
sum total_reasons_O
tab total_reasons
tab total_reasons_all


*** DROP respondents who gave no causes
drop if total_reasons==0
drop if pctpcGE==.


***************************************************
*** 			GENERATE KEY VARIABLES			***
***************************************************
sort episodic
by episodic: means pctpcGE

gen numage=122-age
tab numage

gen male=gender
recode male 2=0
tab male

gen high_edu=0
replace high_edu=1 if edu>=4
tab edu high_edu

gen high_income=0
replace high_income=1 if income>=4
tab income high_income


*************************************************************************************** 
*** Test whether Iyengar's finding of episodic vs. thematic framing effects holds 	***
*** THIS T-TEST PRODUCES THE P-VALUE REPORTED AT THE END OF THE ANALYSIS SECTION 	***
*************************************************************************************** 
ttest pctpcGE, by(episodic)


*************************************************************************************** 
*** Use keywords to identify attribution responses about key topics of interest 	***
*************************************************************************************** 
drop continue1

*** EDUCATION

foreach var of varlist povertycause1-povertycause10 {
  gen edu_`var' = 1 if strpos(`var', "educat") | strpos(`var', "knowledg") | strpos(`var', "learn") | strpos(`var', "school") | strpos(`var', "studies") | strpos(`var', "study") | strpos(`var', "college")
  }
egen edu_causes_total=rowtotal(edu_povertycause1-edu_povertycause10)
tab edu_causes_total


*** LAZINESS

foreach var of varlist povertycause1-povertycause10 {
  gen lazy_`var' = 1 if strpos(`var', "lazy") | strpos(`var', "laziness") | strpos(`var', "willing") | strpos(`var', "motivat") | strpos(`var', "initiative") | strpos(`var', "work ethic") | strpos(`var', "ambitio") | strpos(`var', "hard work") | strpos(`var', "willing") | strpos(`var', "effort") | strpos(`var', "trying") | strpos(`var', "complacen")| strpos(`var', "persever") 
  }
egen lazy_causes_total=rowtotal(lazy_povertycause1-lazy_povertycause10)
tab lazy_causes_total


*** UNEMPLOYMENT

foreach var of varlist povertycause1-povertycause10 {
  gen unemployment_`var' = 1 if strpos(`var', "employ") | strpos(`var', "job") | strpos(`var', "work") | strpos(`var', "compet")  
  }
egen unemployment_causes_total=rowtotal(unemployment_povertycause1-unemployment_povertycause10)
tab unemployment_causes_total


*** COST OF LIVING

foreach var of varlist povertycause1-povertycause10 {
  gen living_`var' = 1 if strpos(`var', "inflat") | strpos(`var', "price") | strpos(`var', "cost") 
  }
egen living_causes_total=rowtotal(living_povertycause1-living_povertycause10)
tab living_causes_total


****************************************************************************************** 
*** Drop items from keyword lists that manual checking revealed were false positives ***
****************************************************************************************** 

***			EDUCATION
recode	edu_povertycause3	(1=0) if case_id==	921
recode	edu_povertycause3	(1=0) if case_id==	918
recode	edu_povertycause5	(1=0) if case_id==	885
recode	edu_povertycause4	(1=0) if case_id==	79
recode	edu_povertycause3	(1=0) if case_id==	776
recode	edu_povertycause3	(1=0) if case_id==	753
recode	edu_povertycause2	(1=0) if case_id==	664
recode	edu_povertycause2	(1=0) if case_id==	653
recode	edu_povertycause5	(1=0) if case_id==	650
recode	edu_povertycause4	(1=0) if case_id==	495
recode	edu_povertycause1	(1=0) if case_id==	307
foreach var of varlist edu_povertycause1-edu_povertycause10 {
	recode `var' (1=0) if case_id==297
	}
recode	edu_povertycause3	(1=0) if case_id==	270
recode	edu_povertycause3	(1=0) if case_id==	211
recode	edu_povertycause3	(1=0) if case_id==	1542
recode	edu_povertycause3	(1=0) if case_id==	1525
recode	edu_povertycause1	(1=0) if case_id==	1507
recode	edu_povertycause2	(1=0) if case_id==	1417
recode	edu_povertycause3	(1=0) if case_id==	1258
recode	edu_povertycause5	(1=0) if case_id==	1197
recode	edu_povertycause4	(1=0) if case_id==	1145
recode	edu_povertycause2	(1=0) if case_id==	1118
recode	edu_povertycause3	(1=0) if case_id==	1046
recode	edu_povertycause3	(1=0) if case_id==	664
recode	edu_povertycause5	(1=0) if case_id==	664
					
								
***			LAZINESS
recode	lazy_povertycause4	(1=0) if case_id==	809
recode	lazy_povertycause2	(1=0) if case_id==	731
recode	lazy_povertycause5	(1=0) if case_id==	650
recode	lazy_povertycause5	(1=0) if case_id==	612
recode	lazy_povertycause5	(1=0) if case_id==	612
recode	lazy_povertycause1	(1=0) if case_id==	480
recode	lazy_povertycause2	(1=0) if case_id==	472
foreach var of varlist lazy_povertycause1-lazy_povertycause10 {
	recode `var' (1=0) if case_id==431
	}
recode	lazy_povertycause1	(1=0) if case_id==	1507
recode	lazy_povertycause2	(1=0) if case_id==	1468
recode	lazy_povertycause3	(1=0) if case_id==	138
recode	lazy_povertycause4	(1=0) if case_id==	1372
recode	lazy_povertycause1	(1=0) if case_id==	1052
				
			
***			COST OF LIVING
recode	living_povertycause2	(1=0) if case_id==	986
recode	living_povertycause4	(1=0) if case_id==	919
recode	living_povertycause2	(1=0) if case_id==	598
recode	living_povertycause1	(1=0) if case_id==	580
recode	living_povertycause2	(1=0) if case_id==	529
recode	living_povertycause4	(1=0) if case_id==	225
recode	living_povertycause5	(1=0) if case_id==	1433
recode	living_povertycause5	(1=0) if case_id==	1432
recode	living_povertycause5	(1=0) if case_id==	1197
recode	living_povertycause2	(1=0) if case_id==	1042
		
		
***			UNEMPLOYMENT
recode	unemployment_povertycause1	(1=0) if case_id==	997
recode	unemployment_povertycause2	(1=0) if case_id==	987
recode	unemployment_povertycause4	(1=0) if case_id==	986
recode	unemployment_povertycause3	(1=0) if case_id==	981
recode	unemployment_povertycause3	(1=0) if case_id==	975
recode	unemployment_povertycause5	(1=0) if case_id==	966
recode	unemployment_povertycause2	(1=0) if case_id==	965
recode	unemployment_povertycause2	(1=0) if case_id==	955
recode	unemployment_povertycause2	(1=0) if case_id==	946
recode	unemployment_povertycause1	(1=0) if case_id==	944
recode	unemployment_povertycause3	(1=0) if case_id==	924
recode	unemployment_povertycause3	(1=0) if case_id==	923
recode	unemployment_povertycause1	(1=0) if case_id==	921
recode	unemployment_povertycause4	(1=0) if case_id==	918
recode	unemployment_povertycause1	(1=0) if case_id==	912
recode	unemployment_povertycause4	(1=0) if case_id==	911
recode	unemployment_povertycause1	(1=0) if case_id==	908
recode	unemployment_povertycause3	(1=0) if case_id==	907
recode	unemployment_povertycause1	(1=0) if case_id==	904
recode	unemployment_povertycause3	(1=0) if case_id==	902
recode	unemployment_povertycause5	(1=0) if case_id==	898
recode	unemployment_povertycause3	(1=0) if case_id==	890
recode	unemployment_povertycause2	(1=0) if case_id==	886
recode	unemployment_povertycause4	(1=0) if case_id==	883
recode	unemployment_povertycause2	(1=0) if case_id==	881
recode	unemployment_povertycause2	(1=0) if case_id==	875
recode	unemployment_povertycause5	(1=0) if case_id==	872
recode	unemployment_povertycause3	(1=0) if case_id==	87
recode	unemployment_povertycause5	(1=0) if case_id==	858
recode	unemployment_povertycause2	(1=0) if case_id==	858
recode	unemployment_povertycause2	(1=0) if case_id==	852
recode	unemployment_povertycause3	(1=0) if case_id==	847
recode	unemployment_povertycause1	(1=0) if case_id==	844
recode	unemployment_povertycause2	(1=0) if case_id==	84
recode	unemployment_povertycause2	(1=0) if case_id==	833
recode	unemployment_povertycause3	(1=0) if case_id==	832
recode	unemployment_povertycause1	(1=0) if case_id==	830
recode	unemployment_povertycause2	(1=0) if case_id==	829
recode	unemployment_povertycause1	(1=0) if case_id==	825
recode	unemployment_povertycause3	(1=0) if case_id==	813
recode	unemployment_povertycause1	(1=0) if case_id==	812
recode	unemployment_povertycause2	(1=0) if case_id==	809
recode	unemployment_povertycause4	(1=0) if case_id==	805
recode	unemployment_povertycause5	(1=0) if case_id==	802
recode	unemployment_povertycause2	(1=0) if case_id==	800
recode	unemployment_povertycause2	(1=0) if case_id==	796
recode	unemployment_povertycause3	(1=0) if case_id==	791
recode	unemployment_povertycause1	(1=0) if case_id==	789
recode	unemployment_povertycause4	(1=0) if case_id==	786
recode	unemployment_povertycause2	(1=0) if case_id==	783
recode	unemployment_povertycause2	(1=0) if case_id==	782
recode	unemployment_povertycause1	(1=0) if case_id==	773
recode	unemployment_povertycause3	(1=0) if case_id==	770
recode	unemployment_povertycause1	(1=0) if case_id==	768
recode	unemployment_povertycause2	(1=0) if case_id==	76
recode	unemployment_povertycause2	(1=0) if case_id==	748
recode	unemployment_povertycause3	(1=0) if case_id==	746
recode	unemployment_povertycause3	(1=0) if case_id==	739
recode	unemployment_povertycause2	(1=0) if case_id==	737
recode	unemployment_povertycause3	(1=0) if case_id==	735
recode	unemployment_povertycause1	(1=0) if case_id==	733
recode	unemployment_povertycause3	(1=0) if case_id==	731
recode	unemployment_povertycause1	(1=0) if case_id==	729
recode	unemployment_povertycause2	(1=0) if case_id==	721
recode	unemployment_povertycause3	(1=0) if case_id==	719
recode	unemployment_povertycause5	(1=0) if case_id==	716
recode	unemployment_povertycause4	(1=0) if case_id==	708
recode	unemployment_povertycause2	(1=0) if case_id==	707
recode	unemployment_povertycause5	(1=0) if case_id==	706
recode	unemployment_povertycause5	(1=0) if case_id==	704
recode	unemployment_povertycause3	(1=0) if case_id==	703
recode	unemployment_povertycause2	(1=0) if case_id==	70
recode	unemployment_povertycause3	(1=0) if case_id==	697
recode	unemployment_povertycause5	(1=0) if case_id==	691
recode	unemployment_povertycause2	(1=0) if case_id==	679
recode	unemployment_povertycause5	(1=0) if case_id==	678
recode	unemployment_povertycause1	(1=0) if case_id==	673
recode	unemployment_povertycause1	(1=0) if case_id==	672
recode	unemployment_povertycause3	(1=0) if case_id==	671
recode	unemployment_povertycause4	(1=0) if case_id==	670
recode	unemployment_povertycause3	(1=0) if case_id==	667
recode	unemployment_povertycause2	(1=0) if case_id==	666
recode	unemployment_povertycause3	(1=0) if case_id==	664
recode	unemployment_povertycause1	(1=0) if case_id==	662
recode	unemployment_povertycause1	(1=0) if case_id==	659
recode	unemployment_povertycause3	(1=0) if case_id==	657
recode	unemployment_povertycause1	(1=0) if case_id==	656
recode	unemployment_povertycause5	(1=0) if case_id==	650
recode	unemployment_povertycause3	(1=0) if case_id==	65
recode	unemployment_povertycause1	(1=0) if case_id==	644
recode	unemployment_povertycause1	(1=0) if case_id==	642
recode	unemployment_povertycause4	(1=0) if case_id==	637
recode	unemployment_povertycause2	(1=0) if case_id==	635
recode	unemployment_povertycause2	(1=0) if case_id==	632
recode	unemployment_povertycause5	(1=0) if case_id==	631
recode	unemployment_povertycause1	(1=0) if case_id==	627
recode	unemployment_povertycause4	(1=0) if case_id==	616
recode	unemployment_povertycause5	(1=0) if case_id==	613
recode	unemployment_povertycause3	(1=0) if case_id==	605
recode	unemployment_povertycause1	(1=0) if case_id==	593
recode	unemployment_povertycause3	(1=0) if case_id==	589
recode	unemployment_povertycause1	(1=0) if case_id==	588
recode	unemployment_povertycause1	(1=0) if case_id==	579
recode	unemployment_povertycause2	(1=0) if case_id==	57
recode	unemployment_povertycause3	(1=0) if case_id==	561
recode	unemployment_povertycause2	(1=0) if case_id==	558
recode	unemployment_povertycause1	(1=0) if case_id==	554
recode	unemployment_povertycause4	(1=0) if case_id==	551
recode	unemployment_povertycause2	(1=0) if case_id==	548
recode	unemployment_povertycause2	(1=0) if case_id==	547
recode	unemployment_povertycause3	(1=0) if case_id==	546
recode	unemployment_povertycause2	(1=0) if case_id==	542
recode	unemployment_povertycause3	(1=0) if case_id==	538
recode	unemployment_povertycause5	(1=0) if case_id==	534
recode	unemployment_povertycause3	(1=0) if case_id==	531
recode	unemployment_povertycause5	(1=0) if case_id==	527
recode	unemployment_povertycause2	(1=0) if case_id==	513
recode	unemployment_povertycause2	(1=0) if case_id==	510
recode	unemployment_povertycause4	(1=0) if case_id==	501
recode	unemployment_povertycause2	(1=0) if case_id==	5
recode	unemployment_povertycause2	(1=0) if case_id==	490
recode	unemployment_povertycause3	(1=0) if case_id==	476
recode	unemployment_povertycause4	(1=0) if case_id==	470
recode	unemployment_povertycause2	(1=0) if case_id==	459
recode	unemployment_povertycause1	(1=0) if case_id==	454
recode	unemployment_povertycause5	(1=0) if case_id==	45
recode	unemployment_povertycause1	(1=0) if case_id==	432
foreach var of varlist unemployment_povertycause1-unemployment_povertycause10 {
	recode `var' (1=0) if case_id==431
	}
recode	unemployment_povertycause2	(1=0) if case_id==	423
recode	unemployment_povertycause4	(1=0) if case_id==	42
recode	unemployment_povertycause2	(1=0) if case_id==	415
recode	unemployment_povertycause4	(1=0) if case_id==	414
recode	unemployment_povertycause2	(1=0) if case_id==	41
recode	unemployment_povertycause1	(1=0) if case_id==	401
recode	unemployment_povertycause2	(1=0) if case_id==	392
recode	unemployment_povertycause2	(1=0) if case_id==	39
recode	unemployment_povertycause2	(1=0) if case_id==	387
recode	unemployment_povertycause1	(1=0) if case_id==	38
recode	unemployment_povertycause2	(1=0) if case_id==	367
recode	unemployment_povertycause3	(1=0) if case_id==	351
recode	unemployment_povertycause3	(1=0) if case_id==	348
recode	unemployment_povertycause3	(1=0) if case_id==	34
recode	unemployment_povertycause4	(1=0) if case_id==	339
recode	unemployment_povertycause3	(1=0) if case_id==	326
recode	unemployment_povertycause4	(1=0) if case_id==	32
recode	unemployment_povertycause2	(1=0) if case_id==	314
recode	unemployment_povertycause2	(1=0) if case_id==	311
recode	unemployment_povertycause3	(1=0) if case_id==	31
recode	unemployment_povertycause5	(1=0) if case_id==	307
recode	unemployment_povertycause5	(1=0) if case_id==	306
recode	unemployment_povertycause1	(1=0) if case_id==	301
recode	unemployment_povertycause2	(1=0) if case_id==	30
recode	unemployment_povertycause1	(1=0) if case_id==	3
recode	unemployment_povertycause2	(1=0) if case_id==	296
recode	unemployment_povertycause2	(1=0) if case_id==	29
recode	unemployment_povertycause4	(1=0) if case_id==	278
recode	unemployment_povertycause2	(1=0) if case_id==	277
recode	unemployment_povertycause3	(1=0) if case_id==	270
recode	unemployment_povertycause1	(1=0) if case_id==	264
recode	unemployment_povertycause2	(1=0) if case_id==	261
recode	unemployment_povertycause4	(1=0) if case_id==	26
recode	unemployment_povertycause1	(1=0) if case_id==	258
recode	unemployment_povertycause1	(1=0) if case_id==	254
recode	unemployment_povertycause2	(1=0) if case_id==	251
recode	unemployment_povertycause3	(1=0) if case_id==	233
recode	unemployment_povertycause1	(1=0) if case_id==	223
recode	unemployment_povertycause2	(1=0) if case_id==	202
recode	unemployment_povertycause1	(1=0) if case_id==	2
recode	unemployment_povertycause3	(1=0) if case_id==	199
recode	unemployment_povertycause1	(1=0) if case_id==	19
recode	unemployment_povertycause3	(1=0) if case_id==	181
recode	unemployment_povertycause1	(1=0) if case_id==	178
recode	unemployment_povertycause3	(1=0) if case_id==	173
recode	unemployment_povertycause5	(1=0) if case_id==	169
recode	unemployment_povertycause4	(1=0) if case_id==	168
recode	unemployment_povertycause1	(1=0) if case_id==	166
recode	unemployment_povertycause3	(1=0) if case_id==	165
recode	unemployment_povertycause3	(1=0) if case_id==	162
recode	unemployment_povertycause1	(1=0) if case_id==	1575
recode	unemployment_povertycause3	(1=0) if case_id==	155
recode	unemployment_povertycause3	(1=0) if case_id==	1544
recode	unemployment_povertycause3	(1=0) if case_id==	1538
recode	unemployment_povertycause2	(1=0) if case_id==	1530
recode	unemployment_povertycause2	(1=0) if case_id==	1518
recode	unemployment_povertycause3	(1=0) if case_id==	1508
recode	unemployment_povertycause1	(1=0) if case_id==	1507
recode	unemployment_povertycause2	(1=0) if case_id==	1503
recode	unemployment_povertycause2	(1=0) if case_id==	1502
recode	unemployment_povertycause4	(1=0) if case_id==	1501
recode	unemployment_povertycause3	(1=0) if case_id==	1500
recode	unemployment_povertycause2	(1=0) if case_id==	1488
recode	unemployment_povertycause5	(1=0) if case_id==	1486
recode	unemployment_povertycause5	(1=0) if case_id==	1483
recode	unemployment_povertycause5	(1=0) if case_id==	148
recode	unemployment_povertycause4	(1=0) if case_id==	1469
recode	unemployment_povertycause3	(1=0) if case_id==	1466
recode	unemployment_povertycause2	(1=0) if case_id==	1464
recode	unemployment_povertycause3	(1=0) if case_id==	1455
recode	unemployment_povertycause2	(1=0) if case_id==	1452
recode	unemployment_povertycause2	(1=0) if case_id==	1448
recode	unemployment_povertycause5	(1=0) if case_id==	1442
recode	unemployment_povertycause4	(1=0) if case_id==	1438
recode	unemployment_povertycause3	(1=0) if case_id==	1433
recode	unemployment_povertycause5	(1=0) if case_id==	1432
recode	unemployment_povertycause3	(1=0) if case_id==	1428
recode	unemployment_povertycause5	(1=0) if case_id==	1413
recode	unemployment_povertycause2	(1=0) if case_id==	1412
recode	unemployment_povertycause3	(1=0) if case_id==	141
recode	unemployment_povertycause3	(1=0) if case_id==	1409
recode	unemployment_povertycause1	(1=0) if case_id==	1406
recode	unemployment_povertycause1	(1=0) if case_id==	1401
recode	unemployment_povertycause4	(1=0) if case_id==	1399
recode	unemployment_povertycause1	(1=0) if case_id==	139
recode	unemployment_povertycause3	(1=0) if case_id==	1386
recode	unemployment_povertycause2	(1=0) if case_id==	1385
recode	unemployment_povertycause2	(1=0) if case_id==	1380
recode	unemployment_povertycause3	(1=0) if case_id==	138
recode	unemployment_povertycause2	(1=0) if case_id==	1378
recode	unemployment_povertycause2	(1=0) if case_id==	1368
recode	unemployment_povertycause3	(1=0) if case_id==	1362
recode	unemployment_povertycause1	(1=0) if case_id==	1355
recode	unemployment_povertycause1	(1=0) if case_id==	1348
recode	unemployment_povertycause2	(1=0) if case_id==	1341
recode	unemployment_povertycause4	(1=0) if case_id==	1333
recode	unemployment_povertycause4	(1=0) if case_id==	1324
recode	unemployment_povertycause1	(1=0) if case_id==	1316
recode	unemployment_povertycause4	(1=0) if case_id==	1312
recode	unemployment_povertycause2	(1=0) if case_id==	1309
recode	unemployment_povertycause2	(1=0) if case_id==	1308
recode	unemployment_povertycause1	(1=0) if case_id==	1303
recode	unemployment_povertycause4	(1=0) if case_id==	1298
recode	unemployment_povertycause2	(1=0) if case_id==	1296
recode	unemployment_povertycause3	(1=0) if case_id==	1282
recode	unemployment_povertycause2	(1=0) if case_id==	1281
recode	unemployment_povertycause2	(1=0) if case_id==	1278
recode	unemployment_povertycause1	(1=0) if case_id==	1274
recode	unemployment_povertycause2	(1=0) if case_id==	1271
recode	unemployment_povertycause4	(1=0) if case_id==	1270
recode	unemployment_povertycause4	(1=0) if case_id==	1260
recode	unemployment_povertycause2	(1=0) if case_id==	1252
recode	unemployment_povertycause4	(1=0) if case_id==	1250
recode	unemployment_povertycause2	(1=0) if case_id==	125
recode	unemployment_povertycause6	(1=0) if case_id==	1242
recode	unemployment_povertycause3	(1=0) if case_id==	1235
recode	unemployment_povertycause1	(1=0) if case_id==	1226
recode	unemployment_povertycause1	(1=0) if case_id==	1226
recode	unemployment_povertycause3	(1=0) if case_id==	1200
recode	unemployment_povertycause1	(1=0) if case_id==	1194
recode	unemployment_povertycause1	(1=0) if case_id==	1192
recode	unemployment_povertycause5	(1=0) if case_id==	1191
recode	unemployment_povertycause1	(1=0) if case_id==	1189
recode	unemployment_povertycause3	(1=0) if case_id==	1188
recode	unemployment_povertycause1	(1=0) if case_id==	1182
recode	unemployment_povertycause3	(1=0) if case_id==	1181
recode	unemployment_povertycause2	(1=0) if case_id==	1180
recode	unemployment_povertycause3	(1=0) if case_id==	1176
recode	unemployment_povertycause4	(1=0) if case_id==	1172
recode	unemployment_povertycause3	(1=0) if case_id==	1171
recode	unemployment_povertycause2	(1=0) if case_id==	1162
recode	unemployment_povertycause3	(1=0) if case_id==	1160
recode	unemployment_povertycause1	(1=0) if case_id==	1152
recode	unemployment_povertycause1	(1=0) if case_id==	1142
recode	unemployment_povertycause2	(1=0) if case_id==	1139
recode	unemployment_povertycause3	(1=0) if case_id==	1133
recode	unemployment_povertycause2	(1=0) if case_id==	1131
recode	unemployment_povertycause3	(1=0) if case_id==	113
recode	unemployment_povertycause1	(1=0) if case_id==	1126
recode	unemployment_povertycause1	(1=0) if case_id==	1124
recode	unemployment_povertycause2	(1=0) if case_id==	1121
recode	unemployment_povertycause3	(1=0) if case_id==	1120
recode	unemployment_povertycause5	(1=0) if case_id==	1119
recode	unemployment_povertycause2	(1=0) if case_id==	1118
recode	unemployment_povertycause2	(1=0) if case_id==	1104
recode	unemployment_povertycause4	(1=0) if case_id==	1100
recode	unemployment_povertycause5	(1=0) if case_id==	1099
recode	unemployment_povertycause1	(1=0) if case_id==	1091
recode	unemployment_povertycause4	(1=0) if case_id==	109
recode	unemployment_povertycause3	(1=0) if case_id==	1087
recode	unemployment_povertycause3	(1=0) if case_id==	1076
recode	unemployment_povertycause2	(1=0) if case_id==	1070
recode	unemployment_povertycause1	(1=0) if case_id==	1067
recode	unemployment_povertycause4	(1=0) if case_id==	106
recode	unemployment_povertycause2	(1=0) if case_id==	1059
recode	unemployment_povertycause5	(1=0) if case_id==	1058
recode	unemployment_povertycause3	(1=0) if case_id==	1043
recode	unemployment_povertycause1	(1=0) if case_id==	1042
recode	unemployment_povertycause1	(1=0) if case_id==	1041
recode	unemployment_povertycause1	(1=0) if case_id==	1037
recode	unemployment_povertycause2	(1=0) if case_id==	1029
recode	unemployment_povertycause3	(1=0) if case_id==	1020
recode	unemployment_povertycause3	(1=0) if case_id==	1019
recode	unemployment_povertycause3	(1=0) if case_id==	1014
recode	unemployment_povertycause5	(1=0) if case_id==	1012
recode	unemployment_povertycause2	(1=0) if case_id==	1000
recode	unemployment_povertycause4	(1=0) if case_id==	1
recode	unemployment_povertycause2	(1=0) if case_id==	997
recode	unemployment_povertycause3	(1=0) if case_id==	39
recode	unemployment_povertycause5	(1=0) if case_id==	109
recode	unemployment_povertycause4	(1=0) if case_id==	138
recode	unemployment_povertycause2	(1=0) if case_id==	139
recode	unemployment_povertycause3	(1=0) if case_id==	139
recode	unemployment_povertycause4	(1=0) if case_id==	139
recode	unemployment_povertycause5	(1=0) if case_id==	162
recode	unemployment_povertycause5	(1=0) if case_id==	165
recode	unemployment_povertycause5	(1=0) if case_id==	168
recode	unemployment_povertycause3	(1=0) if case_id==	202
recode	unemployment_povertycause4	(1=0) if case_id==	202
recode	unemployment_povertycause4	(1=0) if case_id==	251
recode	unemployment_povertycause5	(1=0) if case_id==	251
recode	unemployment_povertycause5	(1=0) if case_id==	254
recode	unemployment_povertycause4	(1=0) if case_id==	261
recode	unemployment_povertycause4	(1=0) if case_id==	277
recode	unemployment_povertycause5	(1=0) if case_id==	278
recode	unemployment_povertycause3	(1=0) if case_id==	387
recode	unemployment_povertycause4	(1=0) if case_id==	476
recode	unemployment_povertycause3	(1=0) if case_id==	490
recode	unemployment_povertycause5	(1=0) if case_id==	513
recode	unemployment_povertycause5	(1=0) if case_id==	561
recode	unemployment_povertycause2	(1=0) if case_id==	588
recode	unemployment_povertycause2	(1=0) if case_id==	627
recode	unemployment_povertycause3	(1=0) if case_id==	641
recode	unemployment_povertycause3	(1=0) if case_id==	656
recode	unemployment_povertycause5	(1=0) if case_id==	659
recode	unemployment_povertycause5	(1=0) if case_id==	664
recode	unemployment_povertycause2	(1=0) if case_id==	672
recode	unemployment_povertycause4	(1=0) if case_id==	719
recode	unemployment_povertycause3	(1=0) if case_id==	733
recode	unemployment_povertycause4	(1=0) if case_id==	735
recode	unemployment_povertycause4	(1=0) if case_id==	746
recode	unemployment_povertycause4	(1=0) if case_id==	768
recode	unemployment_povertycause4	(1=0) if case_id==	791
recode	unemployment_povertycause3	(1=0) if case_id==	800
recode	unemployment_povertycause4	(1=0) if case_id==	800
recode	unemployment_povertycause8	(1=0) if case_id==	805
recode	unemployment_povertycause3	(1=0) if case_id==	809
recode	unemployment_povertycause4	(1=0) if case_id==	809
recode	unemployment_povertycause5	(1=0) if case_id==	809
recode	unemployment_povertycause5	(1=0) if case_id==	812
recode	unemployment_povertycause3	(1=0) if case_id==	829
recode	unemployment_povertycause5	(1=0) if case_id==	829
recode	unemployment_povertycause2	(1=0) if case_id==	830
recode	unemployment_povertycause3	(1=0) if case_id==	833
recode	unemployment_povertycause3	(1=0) if case_id==	875
recode	unemployment_povertycause3	(1=0) if case_id==	886
recode	unemployment_povertycause5	(1=0) if case_id==	908
recode	unemployment_povertycause4	(1=0) if case_id==	912
recode	unemployment_povertycause3	(1=0) if case_id==	921
recode	unemployment_povertycause4	(1=0) if case_id==	923
recode	unemployment_povertycause5	(1=0) if case_id==	924
recode	unemployment_povertycause5	(1=0) if case_id==	946
recode	unemployment_povertycause3	(1=0) if case_id==	1000
recode	unemployment_povertycause4	(1=0) if case_id==	1000
recode	unemployment_povertycause4	(1=0) if case_id==	1014
recode	unemployment_povertycause4	(1=0) if case_id==	1019
recode	unemployment_povertycause3	(1=0) if case_id==	1037
recode	unemployment_povertycause2	(1=0) if case_id==	1067
recode	unemployment_povertycause4	(1=0) if case_id==	1070
recode	unemployment_povertycause3	(1=0) if case_id==	1091
recode	unemployment_povertycause4	(1=0) if case_id==	1118
recode	unemployment_povertycause4	(1=0) if case_id==	1139
recode	unemployment_povertycause4	(1=0) if case_id==	1152
recode	unemployment_povertycause3	(1=0) if case_id==	1189
recode	unemployment_povertycause3	(1=0) if case_id==	1192
recode	unemployment_povertycause4	(1=0) if case_id==	1192
recode	unemployment_povertycause5	(1=0) if case_id==	1192
recode	unemployment_povertycause2	(1=0) if case_id==	1194
recode	unemployment_povertycause3	(1=0) if case_id==	1194
recode	unemployment_povertycause4	(1=0) if case_id==	1226
recode	unemployment_povertycause4	(1=0) if case_id==	1341
recode	unemployment_povertycause2	(1=0) if case_id==	1348
recode	unemployment_povertycause5	(1=0) if case_id==	1355
recode	unemployment_povertycause5	(1=0) if case_id==	1368
recode	unemployment_povertycause5	(1=0) if case_id==	1380
recode	unemployment_povertycause5	(1=0) if case_id==	1399
recode	unemployment_povertycause6	(1=0) if case_id==	1432
recode	unemployment_povertycause5	(1=0) if case_id==	1448
recode	unemployment_povertycause4	(1=0) if case_id==	1452
recode	unemployment_povertycause3	(1=0) if case_id==	1488
recode	unemployment_povertycause5	(1=0) if case_id==	1488
recode	unemployment_povertycause5	(1=0) if case_id==	1502
recode	unemployment_povertycause3	(1=0) if case_id==	1518
recode	unemployment_povertycause4	(1=0) if case_id==	1530
recode	unemployment_povertycause5	(1=0) if case_id==	139
***


*************************************************************************************** 
*** Tally participant self-coded codes 												***
*************************************************************************************** 

*** EDUCATION													
gen	edu_gedo1	=	gedo1	if	edu_povertycause1	==1							
gen	edu_gedo2	=	gedo2	if	edu_povertycause2	==1							
gen	edu_gedo3	=	gedo3	if	edu_povertycause3	==1							
gen	edu_gedo4	=	gedo4	if	edu_povertycause4	==1							
gen	edu_gedo5	=	gedo5	if	edu_povertycause5	==1							
gen	edu_gedo6	=	gedo6	if	edu_povertycause6	==1							
gen	edu_gedo7	=	gedo7	if	edu_povertycause7	==1							
gen	edu_gedo8	=	gedo8	if	edu_povertycause8	==1							
gen	edu_gedo9	=	gedo9	if	edu_povertycause9	==1							
gen	edu_gedo10	=	gedo10	if	edu_povertycause10	==1							
													
egen	countpcD_edu	=	anycount(edu_gedo1	edu_gedo2	edu_gedo3	edu_gedo4	edu_gedo5	edu_gedo6	edu_gedo7	edu_gedo8	edu_gedo9	edu_gedo10),	values(1)
egen	countpcGE_edu	=	anycount(edu_gedo1	edu_gedo2	edu_gedo3	edu_gedo4	edu_gedo5	edu_gedo6	edu_gedo7	edu_gedo8	edu_gedo9	edu_gedo10),	values(2)
egen	countpcO_edu	=	anycount(edu_gedo1	edu_gedo2	edu_gedo3	edu_gedo4	edu_gedo5	edu_gedo6	edu_gedo7	edu_gedo8	edu_gedo9	edu_gedo10),	values(3)
													
egen	totalD_edu	=	total(countpcD_edu)										
egen	totalGE_edu	=	total(countpcGE_edu)										
egen	totalO_edu	=	total(countpcO_edu)										
egen total_edu = rowtotal(totalD_edu totalGE_edu totalO_edu)

												
*** LAZINESS													
gen	lazy_gedo1	=	gedo1	if	lazy_povertycause1	==1							
gen	lazy_gedo2	=	gedo2	if	lazy_povertycause2	==1							
gen	lazy_gedo3	=	gedo3	if	lazy_povertycause3	==1							
gen	lazy_gedo4	=	gedo4	if	lazy_povertycause4	==1							
gen	lazy_gedo5	=	gedo5	if	lazy_povertycause5	==1							
gen	lazy_gedo6	=	gedo6	if	lazy_povertycause6	==1							
gen	lazy_gedo7	=	gedo7	if	lazy_povertycause7	==1							
gen	lazy_gedo8	=	gedo8	if	lazy_povertycause8	==1							
gen	lazy_gedo9	=	gedo9	if	lazy_povertycause9	==1							
gen	lazy_gedo10	=	gedo10	if	lazy_povertycause10	==1							
													
egen	countpcD_lazy	=	anycount(lazy_gedo1	lazy_gedo2	lazy_gedo3	lazy_gedo4	lazy_gedo5	lazy_gedo6	lazy_gedo7	lazy_gedo8	lazy_gedo9	lazy_gedo10),	values(1)
egen	countpcGE_lazy	=	anycount(lazy_gedo1	lazy_gedo2	lazy_gedo3	lazy_gedo4	lazy_gedo5	lazy_gedo6	lazy_gedo7	lazy_gedo8	lazy_gedo9	lazy_gedo10),	values(2)
egen	countpcO_lazy	=	anycount(lazy_gedo1	lazy_gedo2	lazy_gedo3	lazy_gedo4	lazy_gedo5	lazy_gedo6	lazy_gedo7	lazy_gedo8	lazy_gedo9	lazy_gedo10),	values(3)
													
egen	totalD_lazy	=	total(countpcD_lazy)										
egen	totalGE_lazy	=	total(countpcGE_lazy)										
egen	totalO_lazy	=	total(countpcO_lazy)										
egen total_lazy = rowtotal(totalD_lazy totalGE_lazy totalO_lazy)													
												
													
*** COST OF LIVING													
gen	living_gedo1	=	gedo1	if	living_povertycause1	==1							
gen	living_gedo2	=	gedo2	if	living_povertycause2	==1							
gen	living_gedo3	=	gedo3	if	living_povertycause3	==1							
gen	living_gedo4	=	gedo4	if	living_povertycause4	==1							
gen	living_gedo5	=	gedo5	if	living_povertycause5	==1							
gen	living_gedo6	=	gedo6	if	living_povertycause6	==1							
gen	living_gedo7	=	gedo7	if	living_povertycause7	==1							
gen	living_gedo8	=	gedo8	if	living_povertycause8	==1							
gen	living_gedo9	=	gedo9	if	living_povertycause9	==1							
gen	living_gedo10	=	gedo10	if	living_povertycause10	==1							
													
egen	countpcD_living	=	anycount(living_gedo1	living_gedo2	living_gedo3	living_gedo4	living_gedo5	living_gedo6	living_gedo7	living_gedo8	living_gedo9	living_gedo10),	values(1)
egen	countpcGE_living	=	anycount(living_gedo1	living_gedo2	living_gedo3	living_gedo4	living_gedo5	living_gedo6	living_gedo7	living_gedo8	living_gedo9	living_gedo10),	values(2)
egen	countpcO_living	=	anycount(living_gedo1	living_gedo2	living_gedo3	living_gedo4	living_gedo5	living_gedo6	living_gedo7	living_gedo8	living_gedo9	living_gedo10),	values(3)
													
egen	totalD_living	=	total(countpcD_living)										
egen	totalGE_living	=	total(countpcGE_living)										
egen	totalO_living	=	total(countpcO_living)										
egen total_living = rowtotal(totalD_living totalGE_living totalO_living)													
													
													
*** UNEMPLOYMENT													
gen	unemployment_gedo1	=	gedo1	if	unemployment_povertycause1	==1							
gen	unemployment_gedo2	=	gedo2	if	unemployment_povertycause2	==1							
gen	unemployment_gedo3	=	gedo3	if	unemployment_povertycause3	==1							
gen	unemployment_gedo4	=	gedo4	if	unemployment_povertycause4	==1							
gen	unemployment_gedo5	=	gedo5	if	unemployment_povertycause5	==1							
gen	unemployment_gedo6	=	gedo6	if	unemployment_povertycause6	==1							
gen	unemployment_gedo7	=	gedo7	if	unemployment_povertycause7	==1							
gen	unemployment_gedo8	=	gedo8	if	unemployment_povertycause8	==1							
gen	unemployment_gedo9	=	gedo9	if	unemployment_povertycause9	==1							
gen	unemployment_gedo10	=	gedo10	if	unemployment_povertycause10	==1							
													
egen	countpcD_unemployment	=	anycount(unemployment_gedo1	unemployment_gedo2	unemployment_gedo3	unemployment_gedo4	unemployment_gedo5	unemployment_gedo6	unemployment_gedo7	unemployment_gedo8	unemployment_gedo9	unemployment_gedo10),	values(1)
egen	countpcGE_unemployment	=	anycount(unemployment_gedo1	unemployment_gedo2	unemployment_gedo3	unemployment_gedo4	unemployment_gedo5	unemployment_gedo6	unemployment_gedo7	unemployment_gedo8	unemployment_gedo9	unemployment_gedo10),	values(2)
egen	countpcO_unemployment	=	anycount(unemployment_gedo1	unemployment_gedo2	unemployment_gedo3	unemployment_gedo4	unemployment_gedo5	unemployment_gedo6	unemployment_gedo7	unemployment_gedo8	unemployment_gedo9	unemployment_gedo10),	values(3)
													
egen	totalD_unemployment	=	total(countpcD_unemployment)										
egen	totalGE_unemployment	=	total(countpcGE_unemployment)										
egen	totalO_unemployment	=	total(countpcO_unemployment)										
egen total_unemployment = rowtotal(totalD_unemployment totalGE_unemployment totalO_unemployment)													


*************************************************************************************** 
*** Sum totals by categories for participants' self coding 							***
*** THESE VALUES ARE USED TO CREATE FIGURE 1 										***
*************************************************************************************** 

sum	totalD_edu												
sum	totalGE_edu												
sum	totalO_edu												
sum total_edu		
													
sum	totalD_lazy												
sum	totalGE_lazy												
sum	totalO_lazy												
sum total_lazy	

sum	totalD_living												
sum	totalGE_living												
sum	totalO_living												
sum total_living
													
sum	totalD_unemployment												
sum	totalGE_unemployment												
sum	totalO_unemployment												
sum total_unemployment


****************************************************************************************** 
*** Perform t-tests to see whether different demographic groups were more likely to list different types of responsibility attributions ***
*** THE RESULTS F0R EDUCATION AND UNEMPLOYMENT ARE SHOWN IN TABLE 1 ***
****************************************************************************************** 

*** EDUCATION
gen edu_GEscore = countpcGE_edu/(countpcGE_edu+countpcD_edu)
ttest edu_GEscore, by(male)
ttest edu_GEscore, by(white)
ttest edu_GEscore, by(high_edu)
ttest edu_GEscore, by(high_income)

*** UNEMPLOYMENT
gen unemployment_GEscore = countpcGE_unemployment/(countpcGE_unemployment+countpcD_unemployment)
ttest unemployment_GEscore, by(male)
ttest unemployment_GEscore, by(white)
ttest unemployment_GEscore, by(high_edu)
ttest unemployment_GEscore, by(high_income)

*** LAZINESS                                                 
gen lazy_GEscore = countpcGE_lazy/(countpcGE_living+countpcD_lazy)
ttest lazy_GEscore, by(male)
ttest lazy_GEscore, by(white)
ttest lazy_GEscore, by(high_edu)
ttest lazy_GEscore, by(high_income)

*** COST OF LIVING
gen living_GEscore = countpcGE_living/(countpcGE_living+countpcD_living)
ttest living_GEscore, by(male)
ttest living_GEscore, by(white)
ttest living_GEscore, by(high_edu)
ttest living_GEscore, by(high_income)


exit

